﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BUS.DAL;

namespace BUS
{
    [Serializable]
    public class SearchBUS
    {
        private string keyWord;
        public string KeyWord
        {
            get { return keyWord; }
            set { keyWord = value; }
        }

        private int iDCategoryProduct;
        public int IDCategoryProduct
        {
            get { return iDCategoryProduct; }
            set { iDCategoryProduct = value; }
        }

        private int priceFrom;
        public int PriceFrom
        {
            get { return priceFrom; }
            set { priceFrom = value; }
        }

        private int priceTo;
        public int PriceTo
        {
            get
            {
                if (priceTo == -1)
                    priceTo = 1000;
                return priceTo;
            }
            set { priceTo = value; }
        }

        public List<SanPhamBUS> Search()
        {
            var list = SearchDAL.Search(this);
            if (iDCategoryProduct != 0)
                list = list.Where(p => p.LoaiSanPham.ID == iDCategoryProduct).ToList<SanPhamBUS>();
            return list;

        }


    }
}
